package com.maibow.exception;


/**
 * 
 * 脉博网络后台管理系统
 * 包名：com.maibow.exception
 * 文件名：BusinessException.java
 * 作者: 吴比(Wubi)
 * 时间：2015年4月13日-下午1:54:23
 * Copyright@ 2015湖南脉博网络科技有限公司-版权所有
 *
 */
public class BusinessException extends Exception {

    /**
     *
     */
    private static final long serialVersionUID = -9150306475596044200L;

    //错误码
    private int errorCode;

    //错误描述
    private String errorDes;

    public BusinessException() {
        super(ErrorConstants.BASE_ERROR.DES);
        this.errorCode = ErrorConstants.BASE_ERROR.CODE;
    }

    public BusinessException(int errCode) {
        super();
        this.errorCode = errCode;
        this.errorDes = super.getMessage();
    }

    public BusinessException(String message) {
        super(message);
        this.errorCode = ErrorConstants.BASE_ERROR.CODE;
    }

    public BusinessException(int errCode, String message) {
        super(message);
        this.errorCode = errCode;
        this.errorDes = message;
    }

    public BusinessException(Throwable cause) {
        super(cause);
        this.errorCode = ErrorConstants.BASE_ERROR.CODE;
    }

    public BusinessException(int errCode, Throwable cause) {
        super(cause);
        this.errorCode = errCode;
    }

    public BusinessException(String message, Throwable cause) {
        super(message, cause);
        this.errorCode = ErrorConstants.BASE_ERROR.CODE;
        this.errorDes = message;
    }

    public BusinessException(int errCode, String message, Throwable cause) {
        super(message, cause);
        this.errorCode = errCode;
        this.errorDes = message;
    }

    public int getErrorCode() {
        return errorCode;
    }

    public void setErrorCode(int errorCode) {
        this.errorCode = errorCode;
    }

    public String getErrorDes() {
        return errorDes;
    }

    public void setErrorDes(String errorDes) {
        this.errorDes = errorDes;
    }

    public String toString() {
        return "{code:" + getErrorCode() + ",value:" + getErrorDes() + "}";
    }
}
